/**
 * \file NotificationHandler.h
 * \brief NotificationHandler definition class.
 * \author Edouard ROGE
 * \date 10 august 2012
 */

#ifndef _NOTIFICATIONHANDLER_
#define _NOTIFICATIONHANDLER_

#include "Core/Memory/HeapObject.h"
#include "Notification.h"

namespace Core
{
	namespace Notification
	{
		/**
		 * \class NotificationHandler
		 * \brief Base class for an Object which handle a notification
		 */
		class NotificationHandler : public Memory::HeapObject
		{
		public:

			/**
			 * \fn NotificationHandler();
			 * \brief Default Constructor
			 */
			NotificationHandler();

			/**
			 * \fn virtual ~NotificationHandler();
			 * \brief Destructor
			 */
			virtual ~NotificationHandler();

			/**
			 * \fn virtual bool Handle(const Notification & _notification)=0;
			 * \param _notification received notification
			 * \brief Handle and react depending on the notification, must be overridden in subclasses
			 */
			virtual void Handle(const Notification & _notification) = 0;

		protected:

			/**
			 * \fn void Register(const Notification::NotificationType & _type);
			 * \param _type the kind of notification
			 * \brief Unregister itself for this notification type
			 */
			void Register(const NotificationType & _type);

			/**
			 * \fn void Unregister(const Notification::NotificationType & _type);
			 * \param _type the kind of notification
			 * \brief Unregister itself for this notification type
			 */
			void Unregister(const NotificationType & _type);

			/**
			 * \fn void Notify(const Notification::NotificationType & _type) const;
			 * \param _notification the notification
			 * \brief Notify all the Handlers for this kind of notification
			 */
			void Notify(const Notification & _notification) const;

		};
	}
}
#endif // _NOTIFICATIONHANDLER_
